/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package recanto.das.pedrinhas.bean;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.GenericGenerator;

/**
 *
 * @author Guilherme
 */
@Entity
@Table(name = "observacao")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Observacao.findAll", query = "SELECT o FROM Observacao o"),
    @NamedQuery(name = "Observacao.findByIdObs", query = "SELECT o FROM Observacao o WHERE o.idObs = :idObs"),
    @NamedQuery(name = "Observacao.findByDescricao", query = "SELECT o FROM Observacao o WHERE o.descricao = :descricao"),
    @NamedQuery(name = "Observacao.findByDataEntrada", query = "SELECT o FROM Observacao o WHERE o.dataEntrada = :dataEntrada"),
    @NamedQuery(name = "Observacao.findByDataSaida", query = "SELECT o FROM Observacao o WHERE o.dataSaida = :dataSaida")})
public class Observacao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GenericGenerator(name="kaugen" , strategy="increment")
    @GeneratedValue(generator="kaugen")
    @Column(name = "id_obs")
    private Integer idObs;
    @Column(name = "descricao")
    private String descricao;
    @Column(name = "data_entrada")
    @Temporal(TemporalType.DATE)
    private Date dataEntrada;
    @Column(name = "data_saida")
    @Temporal(TemporalType.DATE)
    private Date dataSaida;
    @JoinColumn(name = "titular_id", referencedColumnName = "id_cli")
    @ManyToOne
    private Cliente titularId;
    @JoinColumn(name = "id_cli", referencedColumnName = "id_cli")
    @ManyToOne
    private Cliente idCli;

    public Observacao() {
    }

    public Observacao(Integer idObs) {
        this.idObs = idObs;
    }

    public Integer getIdObs() {
        return idObs;
    }

    public void setIdObs(Integer idObs) {
        this.idObs = idObs;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Date getDataEntrada() {
        return dataEntrada;
    }

    public void setDataEntrada(Date dataEntrada) {
        this.dataEntrada = dataEntrada;
    }

    public Date getDataSaida() {
        return dataSaida;
    }

    public void setDataSaida(Date dataSaida) {
        this.dataSaida = dataSaida;
    }

    public Cliente getTitularId() {
        return titularId;
    }

    public void setTitularId(Cliente titularId) {
        this.titularId = titularId;
    }

    public Cliente getIdCli() {
        return idCli;
    }

    public void setIdCli(Cliente idCli) {
        this.idCli = idCli;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idObs != null ? idObs.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Observacao)) {
            return false;
        }
        Observacao other = (Observacao) object;
        if ((this.idObs == null && other.idObs != null) || (this.idObs != null && !this.idObs.equals(other.idObs))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "recanto.das.pedrinhas.bean.Observacao[ idObs=" + idObs + " ]";
    }
    
}
